/** Created by CUIJA on 05-19-2017.*/

authService.$inject = ['$http'];
var urlBase = '/api';

function authService($http) {

    return {
        regist: function (formdata) {

            return $http.post(urlBase + "/merchant/regist", formdata,{
                transformRequest: angular.identity,
                headers: { "Content-Type": undefined }
            });

        },

        login: function (user) {
            return $http.post(urlBase + '/merchant/login', user);
        },

        updateRealInfo: function (user) {
            return $http.post(urlBase + '/merchant/updateRealInfo', user);
        },

        sendToAdmin: function (user) {
            $http({
                method:'post',
                url:'http://10.222.29.179:3000/NJ_DOM_AEAT/outer/api/verify/add',
                data:user
            }).then(function successCallback(response) {
                console.log('send to A side success')
            }, function errorCallback(response) {
                console.log('fail')
            });
        },


        getFromAdmin: function (mid,sucCallback,failCallback) {
            $http({
                method:'GET',
                url:'http://10.222.29.179:3000/NJ_DOM_AEAT/outer/api/verify/m/'+mid
            }).then(sucCallback,failCallback);
        }
    }

}

module.exports = authService;






